package main

import (
	"fmt"
	"math"
)

func main() {
	// fmt.Println(^1)
	// fmt.Println(43 &^ 43)

	// var x uint8 = 1 << 1
	// var y uint8 = 1 << 5
	// var z uint8 = 1
	// var xx uint8 = 1 >> 1
	// fmt.Printf("%08b\n", x)
	// fmt.Printf("%08b\n", y)
	// fmt.Printf("%08b\n", z)
	// fmt.Printf("%08b\n", xx)

	var x1 uint32 = 1
	fmt.Println(string(x1))
	fmt.Printf("%08b\n", x1)
	// var y1 = unit32 2
	fmt.Println(x1)
	x1 = x1 & (x1 + 2)
	fmt.Println(x1)

	medals := []string{"gold", "silver", "bronze"}
	for i := len(medals) - 1; i >= 0; i-- {
		fmt.Println(medals[i]) // "bronze", "silver", "gold"
	}

	f := 1e100  // a float64
	i := int(f) // 结果依赖于具体实现
	fmt.Println(i)

	o := 0666
	fmt.Printf("%d %[1]o %#[1]o\n", o) // "438 666 0666"
	x := int64(0xdeadbeef)
	fmt.Printf("%d %[1]x %#[1]x %#[1]X\n", x)

	ascii := 'a'
	unicode := '国'
	newline := '\n'
	fmt.Printf("%d %[1]c %[1]q\n", ascii)   // "97 a 'a'"
	fmt.Printf("%d %[1]c %[1]q\n", unicode) // "22269 国 '国'"
	fmt.Printf("%d %[1]q\n", newline)       // "10 '\n'"

	for x := 0; x < 8; x++ {
		fmt.Print("x = %d e^x = %8.3f\n", x, math.Exp(float64(x)))
	}

	fmt.Println(1i * 1i)

}
